public class Solution{
	 public boolean VerifySquenceOfBST(int [] sequence) {
		if(sequence.length==0) return false;
		return SequenceBST(sequence,0,sequence.length-1);
	}
	public boolean SequenceBST(int[] sequence,int start,int root){
		if(start>=root) return true;
		int key=sequence[root];
		int i;
		for(i=start;i<root;i++){
			if(sequence[i]>key){
				break;
			}
		}
		for(int j=i;j<root;j++){
			if(sequence[j]<key){
				return false;
			}
		}
		return SequenceBST(sequence,0,i-1)&&SequenceBST(sequence,i,root-1);
	}
}